package com.freecloud.plug.mybatis.plugins;

import com.freecloud.common.LoggerUtil;
import org.apache.ibatis.executor.resultset.ResultSetHandler;
import org.apache.ibatis.plugin.*;

import java.sql.Statement;

/**
 * @Author: maomao
 * @Date: 2021-04-28 17:42
 */
@Intercepts({@Signature(type = ResultSetHandler.class, //表示要拦截的接口类型
    method = "handleResultSets",  //表示要拦截接口的对应方法
    args = {Statement.class} //表示拦截方法对应的参数列表，反射时使用（解决方法重载问题）
)})
public class UQExceptionInterceptor implements Interceptor {

    @Override
    public Object intercept(Invocation invocation) throws Throwable {
        LoggerUtil.println("解决UQ异常");
        try {
            return invocation.proceed();
        } finally {

        }
    }

    @Override
    public Object plugin(Object target) {
        return Plugin.wrap(target, this);
    }
}
